﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using HotelSoft.HotelManagement_DTO;
namespace HotelSoft.HotelManagement_DAO
{
    class TT_KhachSanDAO
    {
        public DataTable SelectAll()
        {
            string sql = "SELECT * FROM TT_KHACHSAN";
            return Config.AccessHelper.ExecuteQuery(sql);
        }

        public bool Update(object AbstractDTO)
        {
            try
            {
                TT_KhachSanDTO dto = (TT_KhachSanDTO)AbstractDTO;
                string sql = "UPDATE TT_KHACHSAN "+
                             "SET DiaChiKS = N'" + dto.DIACHIKS + 
                             "', SDTKS=N'"+dto.SDTKS+
                             "', Email=N'"+dto.EMAIL+"', Website=N'"+dto.WEBSITE+
                             "' WHERE TenKS=N'" + dto.TENKS + "'";
                Config.AccessHelper.ExecuteNonQuery(sql);
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}
